namespace HEFramework
{
    /// <summary>
    ///
    /// 文件流接口
    /// 
    /// ----------------------------------------
    /// 作者：pan
    /// 创建时间：2022-03-12 23:36:57
    /// ----------------------------------------
    /// </summary>
    public interface IFileStream
    {
        /// <summary>
        /// 文件写入字节（同步）
        /// </summary>
        /// <param name="_filePath">写入数据的文件路径</param>
        /// <param name="_bytes">写入的数据</param>
        void WriteBytesSyn(string _filePath, byte[] _bytes);

        /// <summary>
        /// 文件写入字节（异步）
        /// </summary>
        /// <param name="_filePath"></param>
        /// <param name="_bytes"></param>
        /// <param name="_cancellationToken"></param>
        /// <param name="_bufferSize"></param>
        /// <returns></returns>
        HETask WriteBytesAsync(string _filePath, byte[] _bytes, HECancellationToken _cancellationToken = default, int _bufferSize = 4096);

        /// <summary>
        /// 文件字节读取（同步）
        /// </summary>
        /// <param name="_filePath">读取的文件路径</param>
        /// <returns></returns>
        byte[] ReadBytesSyn(string _filePath);

        /// <summary>
        /// 文件字节读取（异步）
        /// </summary>
        /// <param name="_filePath"></param>
        /// <param name="_cancellationToken"></param>
        /// <param name="_bufferSize"></param>
        /// <returns></returns>
        HETask<byte[]> ReadBytesAsync(string _filePath, HECancellationToken _cancellationToken = default, int _bufferSize = 4096);


        /// <summary>
        /// 检测文件是否存在
        /// </summary>
        /// <param name="_filePath">文件路径</param>
        /// <returns></returns>
        bool CheckFile(string _filePath);

        /// <summary>
        /// 删除文件
        /// </summary>
        /// <param name="_filePath">文件路径</param>
        /// <returns></returns>
        bool DeleteFile(string _filePath);


        /// <summary>
        /// 创建文件夹
        /// </summary>
        /// <param name="_path"></param>
        /// <returns></returns>
        bool CreateDirectory(string _path);


        /// <summary>
        /// 删除文件夹（文件夹本身以及内部所有内容）
        /// </summary>
        /// <param name="_path"></param>
        /// <returns></returns>
        bool DeleteDirectory(string _path);
    }
}